<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>


<html:html>
<head>
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/stkissue2.css" />
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/common/css/stkissue/stkissue.css" />	
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/sampleForm.css" />
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/me.css" />
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/common/css/help/help.css" />
<script type="text/javascript" >
function returnToMainForm(lineNumber, itemOffset) {
	
	var	docNo	= 	document.getElementById("docNo"+itemOffset).innerHTML;
			
	opener.document.getElementById("docNo"+lineNumber).value = docNo;							
			
	window.close(); 
}
function colorOver() {
	
}
</script>

<style>

.odd{background-color:#fFA700; }
.even{background-color:#fFA700; }

.menu-over{background-color:#64b1ff;}

</style>

<script type="text/javascript" >

function modalWinItem(aa) {
	if (window.showModalDialog) {		
		window.showModalDialog(aa,"name","dialogTop:100px;dialogWidth:450px;dialogHeight:350px;center:yes");
	} else {		
		window.open(aa,'name','height=350,width=100,toolbar=no,directories=no,status=no,continued from previous linemenubar=no,scrollbars=no,resizable=no ,modal=yes');
	}
}
</script>
	<link type="text/css" href="<%= request.getContextPath() %>/css/datepicker/css/ui.all.css" rel="stylesheet" /> 
	<script type="text/javascript" src="<%= request.getContextPath() %>/css/datepicker/lib/jquery-ui-1.5.3.min.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
    			$("#dateFind").datepicker({ altField: 'input#dateFind', altFormat: 'yy-mm-dd' });
  		});
	</script>	
</head>

<body onload="document.getElementById('itemFind').focus();"><br />
<div id="wrapper">
	<!-- 
		<div id="header"><img src="images/kiuchilogo.png" width="305" height="80" /></div>
	 -->	 
	<div id="menu"><ul id="nav"></ul></div>
	  
	<div id="content">
		<div id="menuNav">			
			<a href="<%=request.getContextPath() %>/Login.do?mode=check" >หน้าหลัก</a> 
			
			>> คลังพัสดุ - Store กลาง  >> บันทึกใบเบิก >> รายการรอจ่าย (ของเบิก) 			
		</div>		<br />

					
		<div style="background: #ffffff;">	
	<center>
		<div>			
			<html:form action="/stkissue.do?mode=showFind">
				<table>
					<tr>
						<td>ค้นหา เลขที่เอกสาร</td>
						<td>:</td>
						<td><html:text property="itemFind" value="${itemFind}" styleId="itemFind" /></td>
					
						<td>แผนก</td>
						<td>:</td>
						<td><html:select property="deptFind" value="${deptFind}" style="width:120px">
								<html:option value=""></html:option>
								<html:option value="F1-CC">F1-CC</html:option>
								<html:option value="F1-DF">F1-DF</html:option>
								<html:option value="F1-FF">F1-FF</html:option>
								<html:option value="F1-FW">F1-FW</html:option>
								<html:option value="F1-GA">F1-GA</html:option>
								<html:option value="F1-NP">F1-NP</html:option>
								<html:option value="F1-PM">F1-PM</html:option>
								<html:option value="F1-SP">F1-SP</html:option>
								<html:option value="F1-ST">F1-ST</html:option>
								<html:option value="F1-SW">F1-SW</html:option>
								<html:option value="F1-WM">F1-WM</html:option>
								<html:option value="F1-YD">F1-YD</html:option>
								<html:option value="F2-GA">F2-GA</html:option>
								<html:option value="F2-PM">F2-PM</html:option>
								<html:option value="F2-SP">F2-SP</html:option>
								<html:option value="F2-ST">F2-ST</html:option>						
						  </html:select></td>
						<td>ปีเดือน(YYMM)</td>
						<td>:</td>
						<td ><html:text property="dateFind" value="${dateFind}" styleId="dateFind" maxlength="4" style="width:50px" /></td>
					</tr>					
					<tr>
						<td>สถานะ</td>
						<td>:</td>
						<td><html:select property="ittl_status2" value="${ittl_status2}" style="width:155px">
							<html:option value="all">ทุกใบขอเบิก พ.1</html:option>
 							<html:option value="0">ที่รอเบิกจ่าย</html:option>
							<html:option value="1">ที่จ่ายของเบิกแล้ว</html:option>							
						  </html:select></td>
					
						<td>แสดงผล</td>
						<td>:</td>
						<td><html:select property="maxEntriesPerPage" value="${maxEntriesPerPage}" style="width:120px">
							<html:option value="5">5 รายการต่อหน้า</html:option>
							<html:option value="10">10 รายการต่อหน้า</html:option>							
							<html:option value="20">20 รายการต่อหน้า</html:option>
							<html:option value="50">50 รายการต่อหน้า</html:option>							
						  </html:select></td>
						<td ><html:submit value="ค้นหา" /></td> 
					</tr>
					
				</table>
				
				
										  
				
				
			</html:form>						
		</div>
		<div>
		<table border="1" width="95%">
			<tr><td colspan="3" >ค้นหา <font color="red"><b>${itemFind}</b></font> พบ  ${allElement } ระเบียน</td>
				<td colspan="1" align="right">หน้า ${currentPage }/${lastPage }</td>
			</tr>
			<tr><td colspan="4">
					<logic:empty name="firstPage">หน้าแรก</logic:empty>
					<logic:notEmpty name="firstPage">			
						<html:link action="/stkissue.do?mode=showFind&page=${FirstPage }&itemFind=${itemFind }&maxEntriesPerPage=${maxEntriesPerPage }" >หน้าแรก</html:link>
					</logic:notEmpty>
					<logic:empty name="previousPage">ถอยหลัง</logic:empty>
					<logic:notEmpty name="previousPage">
						<html:link action="/stkissue.do?mode=showFind&page=${previousPage }&itemFind=${itemFind }&maxEntriesPerPage=${maxEntriesPerPage }" >ถอยหลัง</html:link>					
					</logic:notEmpty>										
					<logic:empty name="nextPage">ถัดไป</logic:empty>
					<logic:notEmpty name="nextPage">						
						<html:link action="/stkissue.do?mode=showFind&page=${nextPage }&itemFind=${itemFind }&maxEntriesPerPage=${maxEntriesPerPage }" >ถัดไป</html:link>
					</logic:notEmpty>										
					<logic:empty name="lastPage">หน้าสุดท้าย</logic:empty>
					<logic:notEmpty name="lastPage">
						<html:link action="/stkissue.do?mode=showFind&page=${lastPage }&itemFind=${itemFind }&maxEntriesPerPage=${maxEntriesPerPage }" >หน้าสุดท้าย</html:link>
					</logic:notEmpty>
											
				</td>
			</tr>
			<tr class="odd">
				<td width="5%">ลำดับ</td>
				<td width="15%">โหมด</td>
				<td width="20%">เลขที่เอกสาร</td>
				
				<td width="60%">รายละเอียด</td>
						
			</tr>
			
			
			<logic:notEmpty name="itemResults">
				<logic:iterate id="var" name="itemResults" indexId="id">

						<tr onmouseover="this.className='menu-over'" 
							onmouseout="this.className='even'" class="even">
							<td width="5%"> ${id+1+offset }.</td>																		
							<td width="15%">
							 	
								<c:if test="${var.iTTL_status!=-1 }">
									 
									<c:if test="${var.iTTL_status==0 }"> 
										<center>
											<a href="/ittl/stkissue/stkissue.do?mode=approveShow&docNo=${var.docNo }">จ่ายของ</a>
										</center>
									</c:if> 
									 
									<c:if test="${var.iTTL_status==1 }">
										<center>
											<c:if test="${var.hasInBCtrans==0}" >
												<a href="/ittl/stkissue/stkissue.do?mode=approveShowCancel&docNo=${var.docNo }">ยกเลิกการจ่าย</a>
											</c:if>
											<c:if test="${var.hasInBCtrans==1}" >
												ฝ่ายบัญชีทำรายการแล้ว<br /><br />
												<c:if test="${userLevel==10 }">
													<a href="/ittl/stkissue/stkissue.do?mode=approveShowCancel&docNo=${var.docNo }">ยกเลิกการจ่าย</a>
													<br><br>
													user level=${userLevel }<br /><br />
												</c:if>
												
											</c:if>
											
										</center>
									</c:if>
								</c:if>
								<c:if test="${var.iTTL_status==-1 }">สถานะ:<br /><br />ใบ พ.1 ถูกยกเลิก</c:if>
								<c:if test="${var.iTTL_status==4 }">สถานะ:<br /><br />ยืนยันรับแล้ว</c:if>																	
							</td>					
							<td width="20%">
								<label id="docNo${id+1+offset }" >${var.docNo }</label><br /><br />
								ผู้บันทึก:${var.creatorCode }
							</td>
							<td width="60%">
								<table border="1" width="100%">																
										<logic:iterate id="var2"  indexId="id2" collection="${var.bcStkIssueSub2s }">						
									<tr style="align:right" >						
										<td width=70%">${var2.itemName }&nbsp;</td>
										<td width=15%" align="right">${var2.qty }&nbsp;</td>		
										<td width=15%">${var2.ittl_unitName }&nbsp;</td>						
										
									</tr>
										</logic:iterate>													
								</table>								
							</td>
												
						</tr>
				</logic:iterate> 
			</logic:notEmpty>
		</table>
		
		</div>
	</center>
					

<input type="hidden" value="${monthFind }" id="monthFindId">
<script type="text/javascript">

	var item2 = document.getElementById("monthFindId").value;	
	document.formSearch.monthFind[item2-1].selected=true;
	
</script>


</div>
</div>
</body>

</html:html>